1. Field of the Invention
This invention relates in general to computer-implemented database systems, and, in particular, to an embedded storage mechanism for structured data types.
2. Description of Related Art
Databases are computerized information storage and retrieval systems. A Relational Database Management System (RDBMS) is a database management system (DBMS) which uses relational techniques for storing and retrieving data. Relational databases are organized into tables which consist of rows and columns of data. The rows are formally called tuples or records. A database will typically have many tables and each table will typically have multiple tuples and multiple columns. The tables are typically stored on direct access storage devices (DASD), such as magnetic or optical disk drives for semi-permanent storage.
Traditionally, a RDBMS stores simple data, such as numeric and text data. In a traditional RDBMS, the underlying storage management has been optimized for simple data. More specifically, the size of a record is limited by the size of a data page, which is a fixed number (e.g., 4 K) defined by a computer developer. This restriction in turn poses a limitation on the length of data in columns of a table. To alleviate such a restriction, most computer developers today support a new built-in data type for storing large objects (LOBs). Large object types include audio, video, image, text, spatial data (e.g., shape, point, line, polygon, etc.), time series data, OLE documents, Java objects, C++ objects, etc. Large objects typically take up a great deal of storage space. However, the access time for LOB object data is significantly slower than that of simple data types. This occurs because the LOB object data is accessed through a LOB descriptor stored in a record buffer and requires an extra input/output (I/O) access of a database. In many applications, where the average size of an object is typically much smaller than the largest size of the object, using a LOB descriptor is the only way to store object data, but storage comes at the cost of performance. This problem also applies to structured object types, such as abstract data types, arrays, lists, sets, etc.
In some conventional systems, when a column is defined for data of a structured data type, the conventional system stores a token in the column that refers to another table, which contains a column for each attribute of the structured data type. However, if a user wants to store data in that column having more attributes, the conventional system does not have a simple and efficient technique for storing that data in the column.
Moreover, conventional systems are not adequate for handling storage for structured data types for user-defined data. Therefore, there is a need in the art for an improved embedded storage mechanism for structured data types.
To overcome the limitations in the prior art described above, and to overcome other limitations that will become apparent upon reading and understanding the present specification, the present invention discloses a method, apparatus, and article of manufacture for a computer-implemented embedded storage mechanism for structured data types.
In accordance with the present invention, A statement is stored in a database stored on a data storage device connected to a computer. At compile-time, specific methods for a structured data type are mapped to generic methods using parse trees. At run-time, an in-memory representation of the structured data type is generated using the information conveyed in the parse trees. Then, linearization of the generated in-memory representation is performed.
An object of the invention is to provide substitutability for columns defined with structured data types. Another object of the invention is to provide extensibility of a type hierarchy.